//
//  LoginRequest.m
//  TestGizWits
//
//  Created by JM on 15/11/17.
//  Copyright © 2015年 JM. All rights reserved.
//

#import "LoginRequest.h"
#import <XPGWifiSDK/XPGWifiSDK.h>
#import "DYServer.h"
@implementation LoginRequest


- (void)didRealRequest {
    //调用注册方法
    [[XPGWifiSDK sharedInstance] userLoginWithUserName:self.DY_szUserName password:self.DY_szPassword];
}

- (void)XPGWifiSDK:(XPGWifiSDK *)wifiSDK didUserLogin:(NSNumber *)error errorMessage:(NSString *)errorMessage uid:(NSString *)uid token: (NSString *)token {
    if([error intValue] == XPGWifiError_NONE)
    {
        LoginResponse *response = [LoginResponse response];
        response.DY_uid = uid;
        response.DY_token = token;
        response.DY_wifiSDK = wifiSDK;
        self.block(response,nil);
    }
    else
    {
        NSError *newError = [NSError dy_errorWithErrCode:error.integerValue errMessage:errorMessage];
        self.block(nil,newError);
    }
    [super superHandelResponse];
}

@end

@implementation LoginResponse
@end
